var status = -1;
var selectionLog = [];

function start(d, c, b) {
    if (status == 0 && d == 0) {
        qm.dispose();
        return
    }(d == 1) ? status++ : status--;
    selectionLog[status] = b;
    var a = -1;
    if (status <= a++) {
        qm.dispose()
    } else {
        if (status == a++) {
            qm.sendNormalTalk("我可以给你挑战强大的贝勒德的机会。", 0, 9390120, false, true)
        } else {
            if (status === a++) {
                qm.sendNormalTalk("我每天最多可以送你三把入场时所需的钥匙。", 0, 9390120, true, true)
            } else {
                if (status === a++) {
                    qm.askYesNo("你想领取3把入场钥匙吗？", 0, 9390120)
                } else {
                    if (status === a++) {
                        qm.forceStartQuest(17535, "19/12/08");
                        qm.forceStartQuest(17534, "");
                        qm.forceCompleteQuest(17534);
                        qm.gainItemPeriod(4033981, 3, 1);
                        qm.dispose()
                    }
                }
            }
        }
    }
}

function end(d, c, b) {
    if (status == 0 && d == 0) {
        qm.dispose();
        return
    }(d == 1) ? status++ : status--;
    selectionLog[status] = b;
    var a = -1;
    if (status <= a++) {
        qm.dispose()
    } else {
        if (status == a++) {
            qm.sendNormalTalk("我在你的灵魂中注入了可以净化贝勒德的气息。", 0, 9390120, false, true)
        } else {
            if (status === a++) {
                qm.sendNormalTalk("总有一天他心脏中的灵魂一定会得到净化。", 0, 9390120, true, true)
            } else {
                if (status === a++) {
                    qm.sendNormalTalk("现在我该消失了。通过我为你打开的这条路，你可以随时再见到我。", 0, 9390120, true, true)
                } else {
                    if (status === a++) {
                        qm.forceCompleteQuest(17523);
                        qm.dispose()
                    }
                }
            }
        }
    }
};